//
//  OrderItem.swift
//  Fancyswap
//
//  Created by Cheikh Bara on 2015-04-07.
//  Copyright (c) 2015 Jonathan Muschalle. All rights reserved.
//

import UIKit

class OrderItem {
    
    var id:    Int    = 0
    var brand: String = ""
    var name:  String = ""
    var value: Int    = 0
    var size:  String = ""
    var image: String = ""
    
    init(){}
    
    init(id: Int, brand: String, name: String, value: Int, size: String, image: String){
        self.id    = id
        self.brand = brand
        self.name  = name
        self.value = value
        self.size  = size
        self.image = image
    }
    
    
    init(dic: NSDictionary) {
        for elem in dic {
            switch (elem.key as String) {
                case "id":      self.id    = elem.value as Int
                case "brand":   self.brand = elem.value as String
                case "name":    self.name  = elem.value as String
                case "value":   self.value = elem.value as Int
                case "size":    self.size  = elem.value as String
                case "image":   self.image = elem.value as String
                default:        println("Unknown element: \(elem.key as String)")
            }
        }
    }
    
}